function argumentss(x: string, y: string, ...args: number[]) {
    const arr: number[] = [];
    args.forEach((item) => {
        arr.push(item);
    });
    return arr;
}

console.log(argumentss("", "", 1, 23, 4, 66, 5, 2, 2, 5));

function sums(arr: number[]): number {
    let sum: number = 0;
    for (const key of arr) {
        sum += key;
    }
    return sum;
}

console.log(sums([...[1, 2, 3], ...[4, 5, 6]]));


function makeDate(timeStamp: number): Date;

function makeDate(y: number, m: number, d: number): Date;
function makeDate(timeStamp: number, y: number): Date;
function makeDate(timeStamp: number, y?: number, m?: number, d?: number,): Date {
    if (m !== undefined && d !== undefined) {
        return new Date(timeStamp, m, d);
    } else {
        console.log(timeStamp, y)
    }
    return new Date(timeStamp);
}

makeDate(123456789);
makeDate(5, 6, 7);
makeDate(123456789, 7);


function add(a: string, b: number): number
function add(a: number, b: string): string
function add(a: number, b: number): number
function add(a: string, b: string): number
function add(a: string | number, b: string | number): string | number {
    return a + b;
}

add(2, 2)
add("2", "2")
add("2", 2)
add(2, "2")